/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package da;

import entities.UserType;
import java.util.ArrayList;

/**
 *
 * @author Ngoc Mai
 */
public class DAUserType {

    MSSQLConnection conn;
    
    public DAUserType() {
        conn = new MSSQLConnection();  
    }
    
    public ArrayList<UserType> getAll(){
        ArrayList<UserType> list = new ArrayList<UserType>();
        try {
            conn.getConnection();
            conn.cstm = conn.connect.prepareCall("{call sp_getUserType}");
            conn.rs = conn.cstm.executeQuery();
            UserType uType;
            while(conn.rs.next()){
                uType = new UserType();
                uType.setTypeId(conn.rs.getInt("TypeId"));
                uType.setTypeName(conn.rs.getString("TypeName"));
                list.add(uType);
            }
            conn.myClose();
        } catch (Exception e) {
            e.printStackTrace();
        }
        
        return list;
        
    }
    
    
    
    
}
